<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include.inc.jsp"%>

<!-- START Top Navbar-->
<nav role="navigation" class="navbar topnavbar">
	<!-- START navbar header-->
	<div class="navbar-header">
		<a href="#/" class="navbar-brand">
			<div class="brand-logo" style="color: white; font-size: 16px; height: 35px; line-height: 35px;">${sysConfiguration.sysName}</div>
			<div class="brand-logo-collapsed" style="vertical-align: middle; line-height: 43px;">
				<em class="fa fa-car fa-lg" style="color: white;" title="${sysConfiguration.sysName}"></em>
			</div>
		</a>
	</div>
	<!-- END navbar header-->
	<!-- START Nav wrapper-->
	<div class="nav-wrapper">
		<!-- START Left navbar-->
		<ul class="nav navbar-nav">
			<li>
				<!-- Button used to collapse the left sidebar. Only visible on tablet and desktops--> <a href="#"
				data-trigger-resize="" data-toggle-state="aside-collapsed" class="hidden-xs"> <em class="fa fa-navicon"></em>
			</a> <!-- Button to show/hide the sidebar on mobile. Visible on mobile only.--> <a href="#"
				data-toggle-state="aside-toggled" data-no-persist="true" class="visible-xs sidebar-toggle"> <em
					class="fa fa-navicon"></em>
			</a>
			</li>
		</ul>
		<!-- END Left navbar-->
		<!-- START Right Navbar-->
		<ul class="nav navbar-nav navbar-right">
			<!-- start one level menu -->
			<c:forEach items="${sysWebMenulistOne}" var="sysWebMenu" varStatus="status">
				<li><a id='menuitem_${sysWebMenu.id}' onclick="showleft('${sysWebMenu.name}',${sysWebMenu.id});"
					style="cursor: pointer;"> <i class="fa ${sysWebMenu.menuIcon} fa-1x"></i>&nbsp;&nbsp;${sysWebMenu.name}&nbsp;<c:if
							test="${status.index < fn:length(sysWebMenulistOne)-1}">|</c:if>
				</a></li>
			</c:forEach>
			<!-- end one level menu -->

			<!-- START User Info-->
			<li class="dropdown dropdown-list"><a href="#" data-toggle="dropdown"> <em class="icon-user"></em>
			</a> <!-- START Dropdown menu-->
				<ul class="dropdown-menu animated flipInX">
					<li>
						<!-- START list group-->
						<div class="list-group">
							<!-- list item-->
							<a href="#" class="list-group-item" onclick="return false;">
								<div class="media-box">
									<div class="pull-left">
										<em class="fa  fa-meh-o fa-2x text-warning"></em>
									</div>
									<div class="media-box-body clearfix">
										<p class="m0">${trueName}</p>
									</div>
								</div>
							</a>
							<!-- list item-->
							<a href="#" class="list-group-item" onclick="modifyPwdDialog();">
								<div class="media-box">
									<div class="pull-left">
										<em class="fa  fa-gear fa-2x text-info"></em>
									</div>
									<div class="media-box-body clearfix">
										<p class="m0">修改密码</p>
									</div>
								</div>
							</a>
							<!-- list item-->
							<a href="${ctx}/logout" class="list-group-item">
								<div class="media-box">
									<div class="pull-left">
										<em class="fa fa-power-off fa-2x text-danger"></em>
									</div>
									<div class="media-box-body clearfix">
										<p class="m0">注销登录</p>
									</div>
								</div>
							</a>
						</div> <!-- END list group-->
					</li>
				</ul> <!-- END Dropdown menu--></li>
			<!-- END User Info-->

			<!-- Fullscreen (only desktops)-->
			<li class="visible-lg"><a href="#" data-toggle-fullscreen=""> <em class="fa fa-expand"></em>
			</a></li>
			<!-- START Offsidebar button-->
			<li style="display: none;"><a href="#" data-toggle-state="offsidebar-open" data-no-persist="true"> <em
					class="icon-notebook"></em>
			</a></li>
			<!-- END Offsidebar menu-->
		</ul>
		<!-- END Right Navbar-->
	</div>
	<!-- END Nav wrapper-->
</nav>
<!-- END Top Navbar-->

<script type="text/javascript">

	$(function(){
		$(".navbar-right li:first a").click();	
	});

	function showleft(name,id) {
		if(name=="首页"){
			$("#leftmenu").hide();
			$("#mainContent").parent().css("margin-left","0px");
			window.frames['mainFrame'].location.href="${ctx}/gwc/index?menukey="+id;
		}else{
			$("#leftmenu").show();			
			$("#leftmenu").load("${ctx}/login/tree", {
				parentId : id
			});
		}
	}
	
	//======================================================修改密码-begin=====================================================================================
	var modifyPwdDialogItem;
	function modifyPwdDialog() {
		//页面层
		modifyPwdDialogItem = layer.open({
			type : 1,
			title : '修改密码',
			skin : 'layui-layer-rim', //加上边框
			area : [ '420px', '280px' ], //宽高
			content : '<form id="modifyPwdForm" class="dialogform" action="${ctx}/sysUser/modifypwd" methon="POST">' + '<table>'
					+ '<tr><td>原密码：</td><td><input type="password" id="oldpwd" name="oldpwd" class="required"></td></tr>'
					+ '<tr><td>新密码：</td><td><input type="password" id="newpwd" name="newpwd" class="required"></td></tr>'
					+ '<tr><td>重新输入:</td><td><input type="password" id="newpwd2" name="newpwd2" class="required"></td></tr>'
					+ '<tr><td colspan="2" align="center"><a class="mbtn save" href="#" onclick="Save_OnClick(\'modifyPwdForm\')"><span>保存</span></a></td></tr>' + '</table>' + '</form>'
		});
	}
	
	function Save_OnClick(formName) {

		toolbarIndex = layer.msg('保存中...', {
			icon : 16,
			time : 0
		});
		var AjaxURL = $("#" + formName).attr('action');
		
		$.ajax({
			type : "POST",
			url : AjaxURL,
			data : $("#" + formName).serialize(),
			dataType : "json",
			success : AjaxCallbacks,
			error : AjaxCallbacks
		});

	}

	function AjaxCallbacks(result) {
		if (result != null) {

			if (result.state == 1) {
				layer.msg(result.message, {
					icon : 1
				}, function() {
					layer.close(modifyPwdDialogItem);
				});

			} else {
				layer.msg(result.message, {
					icon : 2
				});
			}
		}
	}
	
	/* function modifyPwdAjaxCallback(result) {

		if (result != null) {
			if (result.state == 1) {
				layer.msg(result.message, {
					icon : 1
				}, function() {
					layer.close(modifyPwdDialogItem);
				});

			} else {
				layer.msg(result.message, {
					icon : 2
				});
			}
		}
	} */
	//======================================================修改密码-end=====================================================================================
</script>